
def my_write(s):
    file = open('b.txt', 'a', encoding='utf-8')
    file.write(s)
    file.write('\n')
    file.close()

my_write('绚烂的彩虹')
my_write('可爱的彩虹')

def my_write_list(file, lst):
    file = open(file, 'a', encoding='utf-8')
    file.writelines(lst)
    file.close()

# 调用  lst 列表中的数据类型必须是str
lst = ['姓名\t', '年龄\t', '成绩\t\n', '张三\t', '30\t', '98\t']
my_write_list('c.txt', lst)